int encoder_in = 14;

// Initialize the counter
volatile unsigned int pulses = 0;

void count() {
  // This function is called by the interrupt
  pulses++;
  Serial.println(pulses);
}

void setup() {
  pinMode(encoder_in, INPUT);
  attachInterrupt(0, count, CHANGE);
  Serial.begin(115200);
}

void loop() {
  // Here you can output your counter value e. g. once a second
  //
  //
  delay(10);
}
